package org.example.dao.impl;

import cn.hutool.core.io.IoUtil;
import org.example.dao.UserDao;
import org.example.pojo.User;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class UserDaoImpl implements UserDao {
    @Override
    public List<String> findAll()
    {
        //1.加载并读取文件
        //InputStream in = new FileInputStream(new File("D:\\code\\Web-project01\\springboot-web-01\\src\\main\\resources\\user.txt"))
        InputStream in = this.getClass().getClassLoader().getResourceAsStream("user.txt");
        ArrayList<String> lines = IoUtil.readUtf8Lines(in, new ArrayList<>());
        return lines;
    }
}
